// pages/cate/cate.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    activeKey:0,
    cates:[]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getCates()

  },
  getCates(){
    wx.request({
      url:"http://localhost:3000/api/getcatetree",
      success: res=>{
        this.setData({
          cates: res.data.list,
          content: res.data.list[0].children
        })
      }
    })
  },
  onChange(evt){
    let index = evt.detail
    let content=this.data.cates[index].children
    this.setData({
      content: content
    })
  }
})